<template>
	<view class="protocol">
		<u-checkbox-group size="30" v-model="checked" @change="changeHandler">
			<u-checkbox shape="circle" label="我已阅读并同意" labelSize="24"></u-checkbox>
		</u-checkbox-group>
		<span class="protocol-C" style="color: #ffaa00;" @click="openProtocol">{{name}}</span>
	</view>
</template>

<script>
	import {getAgreementUrl} from "apis/agreement.js"
	/* 协议 */
	export default {
		name: "Agreement",
		props: ["value", "name","type"],
		data() {
			return {
				checked: []
			}
		},
		methods: {
			// 打开协议页面
			async openProtocol() {
				const result = await getAgreementUrl(this.type)
				uni.openDocument({
					filePath: result
				})
				// this.pushNewPage("protocol",{type:this.type,title:this.name})
			},
			changeHandler(list) {
				this.$emit("input", list)
			}
		}
	}
</script>

<style>
	.protocol {
		margin-top: 30rpx;
		z-index: 999;
		display: flex;
		justify-content: center;
		font-size: 24rpx;
		color: #afafaf;
	}
</style>
